import Vue from 'vue'
import VueRouter from 'vue-router'
import Login from '../views/Login'  //登录
import index from '../views/index.vue'  //一级
import Home from '../views/two/home.vue'  //首页
import Room from '../views/two/room.vue'  //找房
import Release from '../views/two/release.vue'  //发布
import Message from '../views/two/message.vue'  //消息
import My from '../views/two/my.vue'  //我的
import buyHouse from '../views/buyHouse' //买房
import rentHouse from '../views/rentHouse' //租房
import mapHouse from '../views/mapHouse'  //地图找房
import mapBuy from '../views/two/map-buy.vue'  //地图找房-分支1
import mapRent from '../views/two/map-rent.vue'  //地图找房-分支2
import Detail from '../views/Detail'  //购房详情页
import Detail2 from '../views/Detail2'  //租房详情页


Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:"/index"
  },
  {
    path: '/index',
    name: 'index',
    component: index,
    redirect:"/index/home",
    children:[
      {
        path: '/index/Home',
        name: 'Home',
        component: Home,
      },
      {
        path: '/index/Room',
        name: 'Room',
        component: Room,
      },
      {
        path: '/index/Release',
        name: 'Release',
        component: Release,
      },
      {
        path: '/index/Message',
        name: 'Message',
        component: Message,
      },
      {
        path: '/index/My',
        name: 'My',
        component: My,
      }
    ]
  },
  //登录
  {
    path: '/Login',
    name: 'Login',
    component: Login
  },
  //买房
  {
    path: '/buyHouse',
    name: 'buyHouse',
    component: buyHouse
  },
  //租房
  {
    path: '/rentHouse',
    name: 'rentHouse',
    component: rentHouse
  },
  //地图找房
  {
    path: '/mapHouse',
    name: 'mapHouse',
    component: mapHouse,
    redirect:"/mapHouse/map-buy",
    children:[
      {
        path: '/mapHouse/map-buy',
        name: 'map-buy',
        component: mapBuy,
      },
      {
        path: '/mapHouse/map-rent',
        name: 'map-rent',
        component: mapRent,
      }
    ]
  },
  //详情数据
  {
    path: '/Detail/:id',
    name: 'Detail',
    component: Detail
  },
  //租房详情数据
  {
    path: '/Detail2/:id',
    name: 'Detail2',
    component: Detail2
  },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
